Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Creating and destroying a class instance
You must use the
NEWstatement to create an instance of a class, and assign the object reference for that instance to an appropriate object reference. This statement invokes any constructor specified for the class to complete class instantiation. You are responsible for deleting (destroying) any instance of a class that you create once it is no longer needed. You can delete class instances using theDELETEOBJECTstatement. This statement invokes any destructor specified for the class instance.For more information on managing the creation and destruction of class instances, see the "Managing the object life-cycle" section. For more information on how the class hierarchy of an object is created and destroyed, see Chapter 3, " Designing Objects — Inheritance, Polymorphism, and Delegation." For more information on using the
NEWstatement to instantiate a class, see the "Creating a class instance using the NEW statement" section.Comparison with procedure-based programming
Using the
NEWstatement to instantiate a class is roughly equivalent to running a persistent procedure using theRUNstatement and setting the procedure object handle. You use theDELETEOBJECTstatement to destroy both a persistent procedure and an instance of a class.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |